home *** CD-ROM | disk | FTP | other *** search
/ Vypalování CD / Vypalovani-CD-cd1.bin / Backup-Burner Add-On SDK 5.0 / ExampleSource / C# / CallingBB.cs
Text File  |  2002-03-23  |  3KB  |  79 lines

  1. // ----------------------------------------------------------------------------
  2. //
  3. //  Project File:  CallingBB.cs
  4. //  A partial program that uses DllImport to access MakeBackupCD from BackupBurner.dll.  
  5. //  As compared to C++, this particular solution doesn't allow for Dynamic binding of the DLL, 
  6. //  although it works if you're sure the dll is going to be in the same place. 
  7. //
  8. //  *Edit the path value before compiling.
  9. //
  10. //  Demo for use with Backup-Burner Add-on SDK
  11. //  February, 2002
  12. //  ⌐Desernet Broadband Media, Inc.
  13. //  Produced by: D. Clark
  14. //  C# port courtesy Michael Malinak.
  15. //  Should compile in Visual C# without errors.
  16. //
  17. // ----------------------------------------------------------------------------
  18.  
  19. using System;
  20. using System.Runtime.InteropServices;
  21. using System.Text;
  22.  
  23. namespace CSBackupBurner
  24. {
  25.     public class BackupBurner
  26.     {
  27.         // Get function reference into DLL
  28.         [DllImport(@"C:\myprogpath\Bin\BackupBurner.dll")]
  29.         public extern static int MakeBackupCD(
  30.             [MarshalAs(UnmanagedType.LPArray)] byte[] szBBRegName, 
  31.             [MarshalAs(UnmanagedType.LPArray)] byte[] szBBRegCode, 
  32.             [MarshalAs(UnmanagedType.LPArray)] byte[] szBBVolume, 
  33.             [MarshalAs(UnmanagedType.LPArray)] byte[] szBBTitle, 
  34.             [MarshalAs(UnmanagedType.LPArray)] byte[] szBBColorForm, 
  35.             [MarshalAs(UnmanagedType.LPArray)] byte[] szBBColorText, 
  36.             [MarshalAs(UnmanagedType.LPArray)] byte[] szPathtoBackupFolder, 
  37.             [MarshalAs(UnmanagedType.LPArray)] byte[] szBBFutureUse);
  38.  
  39.         BackupBurner() 
  40.         {}
  41.  
  42.         public int BurnCD()
  43.         {
  44.             byte[] szBBRegName = new byte[32];
  45.             byte[] szBBRegCode = new byte[512];
  46.             byte[] szBBVolume = new byte[16];
  47.             byte[] szBBTitle = new byte[128];
  48.             byte[] szBBColorForm = new byte[32];
  49.             byte[] szBBColorText = new byte[32];
  50.             byte[] szPathtoBackupFolder = new byte[512];
  51.             byte[] szBBFutureUse = new byte[512];
  52.  
  53.             
  54.             Encoding.ASCII.GetBytes("DEMOUSER").CopyTo(szBBRegName,0);
  55.             Encoding.ASCII.GetBytes("ABCD1234").CopyTo(szBBRegCode,0);
  56.             Encoding.ASCII.GetBytes("MyBackupCD").CopyTo(szBBVolume,0);
  57.             Encoding.ASCII.GetBytes("My Project's Name is __").CopyTo(szBBTitle,0);
  58.             Encoding.ASCII.GetBytes("clSilver").CopyTo(szBBColorForm,0);
  59.             Encoding.ASCII.GetBytes("clBlack").CopyTo(szBBColorText,0);
  60.             Encoding.ASCII.GetBytes(@"C:\myprogpath\FilesToBackup\").CopyTo(szPathtoBackupFolder,0);
  61.             Encoding.ASCII.GetBytes("").CopyTo(szBBFutureUse,0);
  62.                                     
  63.  
  64.             int result = MakeBackupCD(
  65.                 szBBRegName, 
  66.                 szBBRegCode, 
  67.                 szBBVolume, 
  68.                 szBBTitle, 
  69.                 szBBColorForm, 
  70.                 szBBColorText, 
  71.                 szPathtoBackupFolder, 
  72.                 szBBFutureUse);
  73.         
  74.             return result;
  75.         }
  76.  
  77.     }
  78.  
  79. }